﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;

using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using MacViet.DataBaseAPI;

public partial class Control_Prices_List_USPricesList : System.Web.UI.UserControl
{

    protected void Page_Load(object sender, EventArgs e)
    {

        if (!IsPostBack)
        {         

            LoadData();
        }

    }

    private void LoadData()
    {
        SERVICE_CATEGROIESDataAPI api = new SERVICE_CATEGROIESDataAPI();
        int accId = Convert.ToInt32(Session["ACC_ID"]);
        DataTable dt = api.getByACC_ID(accId);
        GrvPriceslist.DataSource = dt;
        GrvPriceslist.DataBind();
    }  

   
    protected void GrvPriceslist_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            HiddenField hdfid = e.Row.FindControl("hdfID") as HiddenField;
            HiddenField hdfName = e.Row.FindControl("hdfName") as HiddenField;
            Repeater rpterData=e.Row.FindControl("rptData") as Repeater;
            Label lblName = e.Row.FindControl("lblName") as Label;
            SERVICESDataAPI api = new SERVICESDataAPI();
            int cateID = int.Parse(hdfid.Value.ToString());
            lblName.Visible = false;
            DataTable dt = api.getBySERCAT_ID(cateID);
            if(dt!=null)
            {
                lblName.Visible = true;
                lblName.Text = hdfName.Value.ToString();
                rpterData.DataSource = dt;
                rpterData.DataBind();

            }
            
        }
    }
    protected void btnManagerSer_Click(object sender, ImageClickEventArgs e)
    {
        Response.Redirect("ServiceManager.aspx");
    }
}
